subroutine r2abij_t1ei_t1am_ijebm(r2, t1, iiabj, & 
               icore, fact)
!
use mod_iop
use mod_ioff
use mod_orbit
use mod_size 
implicit none
!
real*8, intent(in) :: fact
real*4, intent(in) :: r2(*)
real*4, intent(in) :: iiabj(*)
!
real*4, intent(inout) :: t1(*), icore(*)
!
integer :: i, j, a, b, nsize
integer :: i0, i1, i2, i3, i4 
integer, external :: idsymsoc
real*8, external :: dnrm2
!this is to do r2(ab,ij) = r2(abij) - Pab*Pij*t1(ei)*t1(am)*iiabj(bj,em)
i0 = 1                 
i1 = i0 + nvvoo*isd  
i2 = i1 + nvvoo*isd  
i3 = i2 + nvvoo*isd  
i4 = i3 + nvvoo*isd 
!====AAAA
! iiabj(BJ,EM)*t1(EI)*t1(AM)
call isymtrso(iiabj(ioi4(1)), icore(i0), vrta, popa, 1, 0, vrta, popa, 1, 1, 1) 
call VpqrmVms_to_Vpqrs(icore(i0), t1(ifvo(1)), 1, 1, vrta, &
                    vrta, popa, 1, popa, popa, icore(i1), 1, 1.d0, 0.d0)
!tmp(BJ,MI)
call isymtrso(icore(i1), icore(i0), vrta, popa, 1, 0, popa, popa, 1, 1, 1) 
call VpqrmVsm_to_Vpqrs(icore(i0), t1(ifvo(1)), 1, 1, popa, & 
                    vrta, popa, 1, popa, vrta, icore(i1), 1, 1.d0, 0.d0)
!tmp(BJ,IA) to (IJAB)
call sstgenso(icore(i1), icore(i0), nsize, vrta, popa, popa, vrta, & 
                  icore, 1, '3241')
call iassymso(icore(i0), icore(i1), 1, popa, popa, vrta, vrta, 1) 
call itranspso(icore(i1), icore(i0), popa, popa, 1, vrta, vrta, 0, 1)
call iassymso(icore(i0), icore(i1), 1, vrta, vrta, popa, popa, 0) 
call axpyso(nioi31, fact, icore(i1), 1, r2(ioi3(1)), 1)

!====BBBB
! iiabj(bj,em)*t1(ei)*t1(am)
call isymtrso(iiabj(ioi4(3)), icore(i0), vrtb, popb, 1, 0, vrtb, popb, 1, 1, 1)
call VpqrmVms_to_Vpqrs(icore(i0), t1(ifvo(2)), 1, 1, vrtb, &
                    vrtb, popb, 1, popb, popb, icore(i1), 1, 1.d0, 0.d0)
!tmp(BJ,MI)
call isymtrso(icore(i1), icore(i0), vrtb, popb, 1, 0, popb, popb, 1, 1, 1)
call VpqrmVsm_to_Vpqrs(icore(i0), t1(ifvo(2)), 1, 1, popb, &
                    vrtb, popb, 1, popb, vrtb, icore(i1), 1, 1.d0, 0.d0)
!tmp(BJ,IA) to (IJAB)
call sstgenso(icore(i1), icore(i0), nsize, vrtb, popb, popb, vrtb, &
                  icore, 1, '3241')
call iassymso(icore(i0), icore(i1), 1, popb, popb, vrtb, vrtb, 1)
call itranspso(icore(i1), icore(i0), popb, popb, 1, vrtb, vrtb, 0, 1)
call iassymso(icore(i0), icore(i1), 1, vrtb, vrtb, popb, popb, 0)
call axpyso(nioi33, fact, icore(i1), 1, r2(ioi3(3)), 1)
!====ABAB
! iiabj(bj,EM)*t1(EI)*t1(AM)+iiabj(AI,em)*t1(ej)*t1(bm)
!-iiabj(Aj,Em)*t1(EI)*t1(bm)-iiabj(bI,eM)*t1(ej)*t1(AM)
!
!-------   iiabj(bj,EM)*t1(EI)*t1(AM)
call isymtrso(iiabj(ioi4(6)), icore(i0), vrtb, popb, 1, 0, vrta, popa, 1, 1, 1)
call VpqrmVms_to_Vpqrs(icore(i0), t1(ifvo(1)), 1, 1, vrta, &
                    vrtb, popb, 1, popa, popa, icore(i1), 1, 1.d0, 0.d0)
!tmp(bj,MI)
call isymtrso(icore(i1), icore(i0), vrtb, popb, 1, 0, popa, popa, 1, 1, 1)
call VpqrmVsm_to_Vpqrs(icore(i0), t1(ifvo(1)), 1, 1, popa, &
                    vrtb, popb, 1, popa, vrta, icore(i1), 1, 1.d0, 0.d0)
!tmp(bj,IA)
call sstgenso(icore(i1), icore(i0), nsize, vrtb, popb, popa, vrta, & 
                  icore, 1, '4132')
call axpyso(nioi32, fact, icore(i0), 1, r2(ioi3(2)), 1)
!-------   iiabj(AI,em)*t1(ej)*t1(bm)
call isymtrso(iiabj(ioi4(5)), icore(i0), vrta, popa, 1, 0, vrtb, popb, 1, 1, 1)
call VpqrmVms_to_Vpqrs(icore(i0), t1(ifvo(2)), 1, 1, vrtb, &
                    vrta, popa, 1, popb, popb, icore(i1), 1, 1.d0, 0.d0)
!tmp(AI,mj)
call isymtrso(icore(i1), icore(i0), vrta, popa, 1, 0, popb, popb, 1, 1, 1)
call VpqrmVsm_to_Vpqrs(icore(i0), t1(ifvo(2)), 1, 1, popb, &
                    vrta, popa, 1, popb, vrtb, icore(i1), 1, 1.d0, 0.d0)
!tmp(AI,jb)
call sstgenso(icore(i1), icore(i0), nsize, vrta, popa, popb, vrtb, & 
                  icore, 1, '1423')
call axpyso(nioi32, fact, icore(i0), 1, r2(ioi3(2)), 1)
!-------  -iiabj(Aj,Em)*t1(EI)*t1(bm)
call isymtrso(iiabj(ioi4(2)), icore(i0), vrta, popb, 1, 0, vrta, popb, 1, 1, 1)
call VpqrmVms_to_Vpqrs(icore(i0), t1(ifvo(1)), 1, 1, vrta, &
                    vrta, popb, 1, popb, popa, icore(i1), 1, 1.d0, 0.d0)
!tmp(Aj,mI)
call isymtrso(icore(i1), icore(i0), vrta, popb, 1, 0, popb, popa, 1, 1, 1)
call VpqrmVsm_to_Vpqrs(icore(i0), t1(ifvo(2)), 1, 1, popb, &
                    vrta, popb, 1, popa, vrtb, icore(i1), 1, 1.d0, 0.d0)
!tmp(Aj,Ib)
call sstgenso(icore(i1), icore(i0), nsize, vrta, popb, popa, vrtb, & 
                  icore, 1, '1432')
call axpyso(nioi32, -fact, icore(i0), 1, r2(ioi3(2)), 1)
!-------   -iiabj(bI,eM)*t1(ej)*t1(AM)
call isymtrso(iiabj(ioi4(4)), icore(i0), vrtb, popa, 1, 0, vrtb, popa, 1, 1, 1)
call VpqrmVms_to_Vpqrs(icore(i0), t1(ifvo(2)), 1, 1, vrtb, &
                    vrtb, popa, 1, popa, popb, icore(i1), 1, 1.d0, 0.d0)
!tmp(bI,Mj)
call isymtrso(icore(i1), icore(i0), vrtb, popa, 1, 0, popa, popb, 1, 1, 1)
call VpqrmVsm_to_Vpqrs(icore(i0), t1(ifvo(1)), 1, 1, popa, &
                    vrtb, popa, 1, popb, vrta, icore(i1), 1, 1.d0, 0.d0)
!tmp(bI,jA)
call sstgenso(icore(i1), icore(i0), nsize, vrtb, popa, popb, vrta, & 
                  icore, 1, '4123')
call axpyso(nioi32, -fact, icore(i0), 1, r2(ioi3(2)), 1)
!
return
end
